SSR, or Server-Side Rendering, is the process of generating the HTML of a web page on the server instead of in the browser. This allows the client to receive fully rendered HTML, improving performance, SEO, and initial load times.
SvelteKit automatically supports SSR by rendering +page.svelte and +layout.svelte components on the server during the initial request. It also allows hydration on the client so that interactivity is preserved, giving the user a seamless experience.
SSR renders HTML on the server for faster initial load and better SEO.
SvelteKit automatically hydrates the page on the client to make it interactive.
You can fetch data on the server using load() in +page.js or +layout.js.
Endpoints (+server.js) can be used to provide data to SSR pages.
Hybrid rendering is possible: some pages can be fully server-rendered, others client-only.